﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Data;

namespace ConfExpert.Forms.Rapor.YeniYapi
{
    public partial class AtelyeCikanKumas : XForm
    {
        public AtelyeCikanKumas()
        {
            InitializeComponent();
        }

        private void AtelyeCikanKumas_Load(object sender, EventArgs e)
        {
            DataSet d = ExecuteDataSet("GetCikisEmriPivot", 0);
            DataTable dt = d.Tables[0]; //.Copy();
            //DataTable resDt = new DataTable();
            //resDt.Columns.Add("AksesuarId", typeof(int));
            //resDt.Columns.Add("Stok", typeof(int));
            //resDt.Columns.Add("Yaşı", typeof(float));
            //resDt.Columns.Add("Brand", typeof(string));
            //resDt.Columns.Add("SonHareket", typeof(DateTime));

            DataSet d2 = ExecuteDataSet("GetCikisDosyasiz", 0);
            DataTable dt2 = d2.Tables[0];

            DataSet d3 = ExecuteDataSet("GetCikisEmriPivot", 1);
            DataTable dt3 = d3.Tables[0];

            DataSet d4 = ExecuteDataSet("GetCikisDosyasiz", 1);
            DataTable dt4 = d4.Tables[0];

            gvCikisEmri.Init(dt);
            gvCikisDosyasiz.Init(dt2);
            gvErdalBey.Init(dt3);
            gvErdalBey2.Init(dt4);

            //gvCikisEmri.FormatAsDate("SonHareket");
            //gvCikisEmri.MakeColumnInvisible("KumasSayisi");
            gvCikisEmri.FormatAsNumber(0, "CikilanMt", "KullanilanMt", "KalanMt");
            gvCikisEmri.FormatAsNumber(4, "OrtBM");
            gvCikisEmri.AddSummary("SiparisAdet", "KesilenAdet", "CikilanMt", "KullanilanMt", "KalanMt");
            gvCikisDosyasiz.FormatAsNumber(0, "CikilanMt");
            gvCikisDosyasiz.AddSummary("CikilanMt");
            gvErdalBey.FormatAsNumber(0, "CikilanMt", "KullanilanMt", "KalanMt");
            gvErdalBey.AddSummary("SiparisAdet", "KesilenAdet", "CikilanMt", "KullanilanMt", "KalanMt");
            gvErdalBey2.FormatAsNumber(0, "CikilanMt");
            gvErdalBey2.AddSummary("CikilanMt");
            //gvCikisEmri.SetCaptions("Yaşı:Yaşı (Ay Cinsinden)");
            //gvCikisEmri.YanYanaGetir("Brand:ProductCategoryId");
            //gvCikisEmri.YanYanaGetir_Soluna("BrandId", "AksesuarId", "Yaşı", "Stok", "SonHareket");
            //gvCikisEmri.RowCellStyle += gvAksesuarAge_RowCellStyle;
            //gvCikisEmri.BestFitColumns();

            gvCikisEmri.SetFilterTypeToCheckedList("CustomerId", "AtelyeId", "KalanMt", "ProductId");
        }
    }
}